package co.gov.medellin.ssti.sub.model.service.impl;

import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import co.gov.medellin.ssti.sub.model.dao.SedeDAO;
import co.gov.medellin.ssti.sub.model.dao.exception.DAOException;
import co.gov.medellin.ssti.sub.model.service.SedeService;
import co.gov.medellin.ssti.sub.model.vo.SedeVO;
import co.gov.medellin.ssti.sub.model.vo.UsuarioxSedeVO;

@Service
public class SedeServiceImpl implements SedeService {
	@Autowired
	SedeDAO sedeDAOImpl2;

	public List<SedeVO> loadAllSedes() {
		try {
			return sedeDAOImpl2.loadAllSedes();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<UsuarioxSedeVO> findUsuarioxSede(UsuarioxSedeVO criterea) {
		try {
			return sedeDAOImpl2.findUsuarioxSede(criterea);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<SedeVO> findSedes(String nombreSede) {
		try {
			return sedeDAOImpl2.findSedes();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public String findNameByCode(String strCodeSede) {
		try {
			return sedeDAOImpl2.findNameByCode(strCodeSede);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<SedeVO> findTotalSedebyUser(Long codeUser,
			Long codeSubpro, String groupUserName, Long areaUser) {
		try {
			return sedeDAOImpl2.findTotalSedebyUser(codeUser, codeSubpro,
					groupUserName, areaUser);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<SedeVO> findTotalSedebyUser(Long codeUser,
			Long codeSubpro, String groupUserName, Long areaUser,
			String codeSede) {
		try {
			return sedeDAOImpl2.findTotalSedebyUser(codeUser, codeSubpro,
					groupUserName, areaUser, codeSede);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<SedeVO> findSedesAsociadas(String codeSub) {
		try {
			return sedeDAOImpl2.findSedesAsociadas(codeSub);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	public Collection<SedeVO> findSedes() {
		try {
			return sedeDAOImpl2.findSedes();
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int desactivarSede(SedeVO sedeVO) {
		try {
			return sedeDAOImpl2.desactivarSede(sedeVO);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int insert(SedeVO sedeVO) {
		try {
			return sedeDAOImpl2.insert(sedeVO);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

	@Override
	public int update(SedeVO sedeVO) {
		try {
			return sedeDAOImpl2.update(sedeVO);
		} catch (Exception e) {
			throw new DAOException(e);
		}
	}

}
